package com.tencent.hummingbird.portal.controller;


import com.github.pagehelper.PageInfo;
import com.tencent.hummingbird.portal.pojo.Question;
import com.tencent.hummingbird.portal.r.R;
import com.tencent.hummingbird.portal.service.IQuestionTagService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yxb
 * @since 2024-01-10
 */
@Slf4j
@RestController
@RequestMapping("/portal/questionTag")
public class QuestionTagController {
    @Autowired
    private IQuestionTagService questionTagService;
    @GetMapping("/tagQuestion/{tagId}/{pageNum}/{pageSize}/{search}")
    public R<PageInfo<Question>> tagQuestion(@PathVariable Integer tagId,
                                             @PathVariable Integer pageNum,
                                             @PathVariable Integer pageSize,
                                             @PathVariable String search){
        log.info("pageNum:{}",pageNum);
        log.info("pageSize:{}",pageSize);
        PageInfo pageInfo = questionTagService.getQuestionByTagId(tagId,pageNum,pageSize,search);
        return R.ok(pageInfo);
    }
}
